package com.tomecode.tools.maven.settings.model;

/**
 * 
 * The layouts of repositories being mirrored. This value can be used to
 * restrict the usage of the mirror to repositories with a matching layout
 * (apart from a matching id). Since Maven 3.
 * 
 * @author Tomas Frastia
 * @see http://www.tomecode.com or
 *      http://code.google.com/p/maven-settings-editor/
 * 
 */
public enum MirrorOfLayouts {

	EMPTY(""), DEFAULT("default"), LEGACY("legacy");

	private final String name;

	public final String toString() {
		return name;
	}

	private MirrorOfLayouts(String name) {
		this.name = name;
	}

	public static final MirrorOfLayouts parse(String mirrorLayout) {
		if (mirrorLayout == null || mirrorLayout.trim().length() == 0) {
			return EMPTY;
		}

		for (MirrorOfLayouts cp : values()) {
			if (cp.toString().equals(mirrorLayout)) {
				return cp;
			}
		}
		return EMPTY;
	}
}
